define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {

		//返回信息
		return {
			get_list:function(group_type,nPage,key,callback,calldone){
				Http.post({
					method:'chat.group.getlist',
					group_type:group_type,
					nPage:nPage,
					pagelimit:6,
					key:key
				},function(result){
					if(callback)
					callback(result.result);
				},function(e) {
					//请求异常
				},function(){
					if(calldone)
					calldone();
				})
			},
			apply_discussion:function(group_name,group_pic,group_brief,callback){
				Http.post({
					method:'chat.group.apply',
					group_name:group_name,
					group_pic:group_pic,
					group_brief:group_brief
				},function(result){
					if(callback)
					callback(result);
				})
			},
			get_loginfo:function(callback){
				Http.post({
					method:'chat.group.getlogininfo'
				},function(result){
					if(callback)
					callback(result.result);
				})
			},
			join_group:function(group_id,callback){
				Http.post({
					method:'chat.group.joingroup',
					group_id:group_id
				},function(result){
					if(callback)
					callback(result.result);
				})
			},
			//卖家入门、买家入门文章
			get_base:function(nPage,kind,key,callback,calldone){
				Http.post({
					method:'info.explaindoc.getlist',
					kind:kind,//1==卖家   2==买家
					nPage:nPage,
					pagelimit:20,
					key:key
				},function(result){
					if(callback)
					callback(result.result);
				},function(e) {
					//请求异常
				},function(){
					if(calldone)
					calldone();
				})
			},
			//获取用户信息
			getUserInfo: function(callback) {
				Http.post({
					method: 'member.get'
				}, function(result) {
					if(callback)
						callback(result.result);
				}, function(e) {

				}, function() {
					
				})
			}
			
			
		};
	}

	factory.$inject = ['Http'];
	return app.registerService("Exchange_interaction", factory);
});